import type { MenumItem } from './model/menuModel'

import { requestClient } from '#/api/request'

// 角色管理
export default class SysMenuApi {
    static get inst() {
        return SysMenuApi._inst || (SysMenuApi._inst = new SysMenuApi())
    }
    private static _inst: SysMenuApi

    add(params: Partial<MenumItem>) {
        return requestClient.post<null>('/menu/add', params)
    }
    delete(ids: Array<number | string>) {
        return requestClient.delete<null>(`/menu/delete/${ids}`)
    }

    edit(params: Partial<MenumItem>) {
        return requestClient.put<null>('/menu/edit', params)
    }

    /**
     * 列表分页
     */
    getPageList(params: { title: string }) {
        return requestClient.get<MenumItem[]>('/menu/index', { params })
    }
}
